﻿CREATE TABLE [dbo].[tlog_State] (
    [ID]        INT            IDENTITY (1, 1) NOT NULL,
    [TablePK]   INT            NOT NULL,
    [TableName] VARCHAR (128)  NOT NULL,
    [StateFrom] INT            NOT NULL,
    [StateTo]   INT            NOT NULL,
    [DateTime]  DATETIME       NOT NULL,
    [UserName]  NVARCHAR (128) NOT NULL,
    [IsFirst]   BIT            NOT NULL,
    [IsLast]    BIT            NOT NULL,
    [DayOfYear] AS             (datepart(dayofyear,[DateTime])),
    [Date]      AS             (dateadd(day,(0),datediff(day,(0),[DateTime]))),
    [Year]      AS             (datepart(year,[DateTime])),
    [Month]     AS             (datepart(week,[DateTime]))
);

